<template>
  <div>

    <div v-if="shoplists==0">
    <!-- <loading v-if="shoplists==0"></loading> -->
    <van-empty image="search" description="搜索不到……" />      
    </div>
    <div v-if="shoplists!=0">
      <shop-list :shoplist="shoplists"></shop-list>
    </div>
    <!-- <div>{{result}}</div> -->
  </div>
</template>
<script>
import ShopList from "@/components/ShopList";
// import Loading from "@/components/Loading";
export default {
  props: {
    keywords: String,
    shoplist: Array,
    // shoplist
  },
  data() {
    return {
      res: null,
      shoplists: [],
    };
  },
  // created() {
  //   this.axios.get(`"/products?&keyword=${keywords}"`).then((res) => {
  //     console.log(res);
  //   });
  // },
  created() {
    this.axios.get(`/products?&keyword=${this.keywords}`).then((res) => {
      // console.log(res);
      this.shoplists = res;
      console.log(this.shoplists);
    });
  },
  methods: {
    // async getResult() {
    //   // let offset = (this.page - 1) * this.limit;
    //   await this.axios
    //     .get(
    //       `/products?&keyword=${this.keywords}`
    //     )
    //     .then((result) => {
    //       // if (result.songCount == 0) {
    //       //   this.isloading = false;
    //       //   this.isMore = false;
    //       //   return;
    //       console.log(result);
    //       // },
    //       // let re = result.songs.map((v) => {
    //       //   v.song = {
    //       //     privilege: v.privilege,
    //       //     artists: v.ar,
    //       //     album: v.al,
    //       //   };
    //       //   return v;
    //       // });
    //       // this.result = this.result.concat(re);
    //       // this.isloading = false;
    //     });
    // },
  },
  components: {
    ShopList,
    // Loading,
  },
};
</script>